package me.zhengjie.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.dao.MaterialDao;
import me.zhengjie.dao.MaterialDetailDao;
import me.zhengjie.server.MaterialDetailService;
import me.zhengjie.server.MaterialService;
import me.zhengjie.utils.PageResult;
import me.zhengjie.utils.Result;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

@RestController
@RequiredArgsConstructor
@Api(tags = "调拨单详情管理")
@RequestMapping("/api/materialDetail")
public class MaterialDetailController {

    private final MaterialDetailService materialDetailService;

    private final MaterialService materialService;

    @GetMapping
    @Log("查询调拨单详情原物料")
    @ApiOperation("查询MaterialDetailDao")
    public Result<PageResult<MaterialDetailDao>> queryOutBoundOrder(MaterialDetailDao criteria){
        return Result.ok(materialDetailService.queryAll(criteria));
    }

//    @GetMapping("notOutBoundOrder")
//    @Log("查询非原物料")
//    @ApiOperation("查询非原物料")
//    // @PreAuthorize("@el.check('materialDetailDao:list')")
//    public ResponseEntity<PageResult<MaterialDao>> OutBoundOrder(@RequestBody MaterialDao criteria, Page<Object> page){
//        return new ResponseEntity<>(materialService.queryAll(criteria,page), HttpStatus.OK);
//    }

}
